home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / postscript.341 < prev    next >
Text File  |  1992-02-06  |  2KB  |  52 lines

  1. {\rtf0\ansi{\fonttbl\f1\fnil Times-Roman;\f2\fmodern Courier;\f0\fswiss Helvetica;}
  2. \paperw13040
  3. \paperh10800
  4. \margl120
  5. \margr120
  6. \pard\tx620\tx1240\tx1860\tx2480\tx3100\tx3720\tx4340\tx4980\tx5600\tx6220\f1\b0\i0\ul0\fs28 pswrap postscript appkit\
  7. \
  8. Q:  Why can't I get 
  9. \b pswrap
  10. \b0  to return arrays as described in the 
  11. \b pswrap
  12. \b0  manual (p15)?\
  13. \
  14.  
  15. \f2\fs24     defineps GetCharBoundingBox (char *c | float rect[4])\
  16.            gsave nulldevice\
  17.            newpath 0 0 moveto (c) false charpath flattenpath pathbbox \
  18.         %\
  19.            % At this point the stack contains 4 floats.\
  20.         % The next line should cause the 4 values to be loaded into rect.\
  21.         % It doesn't seem to work.\
  22.         %\
  23.         rect \
  24.            grestore\
  25.     endps\
  26.  
  27. \f1\fs28 \
  28. A:  This is a  missing feature in 
  29. \b pswrap
  30. \b0 ; you can't assign multiple values like that.  The rule is that everytime an output param name is encountered, the value from the top of the stack is placed in the output param.  Thus you either need to mention the name "rect" four times:\
  31. \
  32.  
  33. \f2\fs24         rect rect rect rect\
  34.  
  35. \f1\fs28 \
  36. or do something more general like\
  37. \
  38.  
  39. \f2\fs24         4 \{rect\} repeat\
  40.  
  41. \f1\fs28 \
  42. to load the four return values on the stack into rect.  Of course the values will be loaded into rect in the reverse order; if the stack contained the four values a, b, c, and d, with d on top, then rect[0] will contain d, rect[1] will contain c, and so on.  You might want to rearrange the array on the c-side once you return from the 
  43. \b pswrap
  44. \b0  function.\
  45. \
  46. QA341\
  47. \
  48. Valid for 1.0\
  49. Valid for 2.0\
  50. \
  51.  
  52.